<template>
  <div class="main">
    <!-- <button @click="handleExitClick">退出登录</button> -->
    <el-container class="main-content">
      <el-aside :width="isFold ? '60px' : '210px'">
        <main-menu :is-fold="isFold" />
      </el-aside>
      <el-container>
        <el-header height="50px">
          <mainHeader @fold-change="handleFoldChange" />
        </el-header>
        <el-main>
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script setup lang="ts">
import mainMenu from '@/components/main-menu/main-menu.vue'
import mainHeader from '@/components/main-header/main-header.vue'
import { ref } from 'vue'

// 处理main-header中的折叠变化
const isFold = ref(false)
function handleFoldChange(flag: boolean) {
  isFold.value = flag
}
</script>

<style lang="less" scoped>
.main {
  height: 100%;
}

.main-content {
  height: 100%;

  .el-aside {
    overflow-x: hidden;
    overflow-y: auto;
    line-height: 200px;
    text-align: left;
    cursor: pointer;
    background-color: #001529;
    scrollbar-width: none;
    -ms-overflow-style: none;

    // 折叠动画
    transition: width 0.2s ease;

    &::-webkit-scrollbar {
      display: none;
    }
  }

  // .el-header {
  //   background-color: skyblue;
  // }

  .el-main {
    background-color: #f0f2f5;
  }
}
</style>
